package com.ghpt.controller;
import com.ghpt.pojo.ChouShui;
import com.ghpt.service.ChouShuiService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
@RestController
@RequestMapping("/choushui")
public class ChouShuiController {
    private final ChouShuiService chouShuiService;

    public ChouShuiController(ChouShuiService chouShuiService) {
        this.chouShuiService = chouShuiService;
    }
    @GetMapping("/{id}")
    public ChouShui getChouShuiById(@PathVariable Long id) {
        System.out.println("结果是"+chouShuiService.findChouShuiById(id));
        return chouShuiService.findChouShuiById(id);
    }
    @PutMapping
    public int updateChouShui(@RequestBody ChouShui chouShui) {
        return chouShuiService.updateById(chouShui);
    }
}
